import requests

# 设置参数
# url = "https://fanyi.baidu.com/sug"
# headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
#                          "Chrome/90.0.4430.93 Safari/537.36"}
# query = input("请输入你要翻译的内容:")
# Form_Data = {'kw': query}
# r = requests.post(url=url, data=Form_Data, headers=headers)
# r.encoding = "utf-8"
# text = r.text.encode('utf-8').decode('unicode_escape')
# print(text)
url = 'https://fanyi.baidu.com/sug'
query = input("请输入你要翻译的内容:")
data = {'kw': query}
res = requests.post(url, data=data).json()
print("中文意思：{}".format(res['data'][0]['v']))
